﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ueEngine.Biz.Inf.LogicEntity.SupportData;
using ueEngine.Biz.Inf.Entities;
using ueEngine.Biz.Inf.Entities.DBSupport;

namespace ueEngine.Biz.Inf.LogicEntity
{
    public class AttentionModel : IAccessible<Attention,AttentionModel>
    {
        #region self
        public int Id { get; set; }

        /// <summary>
        /// 关注分类
        /// </summary>
        public AttentionType AttentionType { get; set; }

        /// <summary>
        /// 关注事件的发起者
        /// </summary>
        public string Master { get; set; }

        /// <summary>
        /// 被关注的对象
        /// </summary>
        public string Target { get; set; }

        public DateTime AddDate { get; set; }
        #endregion

        protected override void Covariant(Attention dbModel)
        {
            this.AddDate = dbModel.AddDate;
            this.AttentionType = (AttentionType)dbModel.AttentionType;
            this.Id = dbModel.Id;
            this.Master = dbModel.Master;
            this.Target = dbModel.Target;
        }
        protected override Attention Inverter(AttentionModel model)
        {
            return new Attention()
            {
                AddDate = model.AddDate,
                AttentionType = (int)model.AttentionType,
                Id = model.Id,
                Master = model.Master,
                Target = model.Target
            };
        }
        //public override AttentionModel Element(System.Linq.Expressions.Expression<Func<Attention, bool>> where)
        //{
        //    var item = new Attention().Get(where);
        //    if (item != null)
        //    {
        //        Covariant(item);
        //        return this;
        //    }
        //    return null;
        //}
        //public override List<TResult> Elements<TResult>(System.Linq.Expressions.Expression<Func<Attention, bool>> where, System.Linq.Expressions.Expression<Func<Attention, TResult>> select)
        //{
        //    using (Context ctx = new Context())
        //    {
        //        return ctx.Attention.Where(where).Select(select).ToList();
        //    }
        //}
    }
}
